package com.sdry.service.approval.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sdry.entity.ApprovalCustomEntity;
import com.sdry.entity.ApprovalEntity;
import com.sdry.entity.PageEntity;
import com.sdry.entity.agreement.Agreement;
import com.sdry.entity.approval.Approval;
import com.sdry.entity.approval.ApprovalExample;
import com.sdry.entity.approvalManagement.ApprovalDetail;
import com.sdry.entity.base.Department;
import com.sdry.entity.base.Staff;
import com.sdry.mapper.approval.ApprovalMapper;
import com.sdry.service.approval.ApprovalService;
/**
 * 
 * @ClassName ApprovalServiceImpl
 * @Description 审批Service实现类
 * @Author lz
 * @Date 2018年9月3日 13:52:13
 * @Version 1.0
 */
@Service
@Transactional
public class ApprovalServiceImpl implements ApprovalService{

	@Resource
	ApprovalMapper approvalMapper;
	
	/**
	 * 分页查询所有待审批
	 * @param pageEntity
	 * @return
	 */
	@Override
	public List<ApprovalCustomEntity> queryAllApproval(PageEntity pageEntity) {
		return approvalMapper.queryAllApproval(pageEntity);
	}
	
	/**
	 * 分页查询所有待审批条数
	 * @param pageEntity
	 * @return
	 */
	@Override
	public Long queryAllApprovalCount(PageEntity pageEntity) {
		return approvalMapper.queryAllApprovalCount(pageEntity);
	}

	/**
	 * 插入提交审批信息
	 * @param approval
	 * @return
	 */
	@Override
	public Integer insertDept(ApprovalEntity approval) {
		return approvalMapper.insertDept(approval);
	}
	
	/**
	 * 查询所有部门：下拉框显示
	 * @return
	 */
	public List<Department> queryAllDept() {
		return approvalMapper.queryAllDept();
	}
	
	@Override
	public List<Approval> selectByExample(ApprovalExample example) {
		return approvalMapper.selectByExample(example);
	}

	@Override
	public ApprovalEntity findApprovalEntityByID(long approvalId) {
		return approvalMapper.findApprovalEntityByID(approvalId);
	}

	@Override
	public Integer setStatus(ApprovalEntity approvalEntity) {
		return approvalMapper.setStatus(approvalEntity);
	}

	@Override
	public List<Agreement> queryHTMLByAppId(String approvalId) {
		return approvalMapper.queryHTMLByAppId(approvalId);
	}
	

	@Override
	public ApprovalDetail selectForm(String approvalId) {
		return approvalMapper.selectForm(approvalId);
	}

	@Override
	public ApprovalEntity findById(Long approvalId) {
		return approvalMapper.findById(approvalId);
	}

	@Override
	public void deleteByid(Long approvalId) {
		approvalMapper.deleteByid(approvalId);
	}

	@Override
	public String queryFieldTypeByFieldNameArr(String fieldNameArr) {
		return approvalMapper.queryFieldTypeByFieldNameArr(fieldNameArr);
	}


	@Override
	public List<Staff> queryPeopleByDept(Long did) {
		return approvalMapper.queryPeopleByDept(did);
	}

	@Override
	public List<Agreement> selectAgreementByApprovalId(String aremark) {
		return approvalMapper.selectAgreementByApprovalId(aremark);
	}

	@Override
	public List<Agreement> selectAgreementByAremark2(String aremark) {
		return approvalMapper.selectAgreementByAremark2(aremark);
	}
}
